<template>
  <div class="home">
    <header>
      <div class="header-nav">
        头部导航===home
        <button @click="flag = !flag">菜单折叠</button>
      </div>
      <button @click="exit">退出登录</button>
    </header>
    <main>
      <nav :class="flag ? '' : 'active'">
        <ul>
          <li><router-link to="/">first</router-link></li>
          <li><router-link :to="second">second</router-link></li>
          <li><router-link :to="third">third</router-link></li>
          <li><router-link :to="forth">forth</router-link></li>
        </ul>
      </nav>
      <div class="right">放右侧导航内容<router-view></router-view></div>
    </main>
    <footer>底部导航</footer>
  </div>
</template>
<script>

export default {
  name: 'home',
  data () {
    return {
      second: {
        path: '/second',
        query: {
          id: 2
        }
      },
      third: {
        name: 'Third',
        params: {
          ids: 3
        }

      },
      forth: {
        name: 'Forth',
        params: { age: 4 },
        query: {
          num: 4
        }
      },
      flag: true

    }
  },
  created () {
  },
  computed: {
  },
  methods: {
    exit () {
      //跳转登录页
      this.$router.push('/login')
    }
  }
}
</script>
<style lang='less'  scoped>
* {
  margin: 0;
  padding: 0;
}
.home {
  width: 100vw;
  height: 100vh;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  header {
    display: flex;
    justify-content: space-between;
    height: 40px;
    background-color: pink;
  }
  footer {
    height: 40px;
    text-align: center;
    background-color: pink;
  }
  main {
    flex: 1;
    display: flex;
    justify-content: space-between;
    background-color: skyblue;
    nav {
      width: 150px;
      // height: 100%;
      background-color: wheat;
      &.active {
        width: 50px;
        transition: all 1s;
      }
    }
    .right {
      flex: 1;
    }
    .router-link-exact-active {
      background-color: greenyellow;
    }
    a {
      text-decoration: none;
    }
  }
}
</style>
